<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>彩贻现货</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
<link href="css/css.css" rel="stylesheet" type="text/css">
<link href="css/main.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="js/jquery-1.js"></script>
<script type="text/javascript" src="js/jquery-1.11.2.min.js"></script>
<script type="text/javascript" src="js/base.js"></script>
<script type="text/javascript" src="js/tab.js"></script>
<script type="text/javascript">
$(function(){
	$.ajax({
		type:'post',
		url:newsMain,
		data:{
			sid:'10001',
			pn:'1'
		},
          success : function(json) {
        	  var count = json.Resp.data;
        	  var zb =document.getElementById('zbs');
        	  if(count!=null){
	      		for(var i=0;i<count.length;i++){
	      			zb.innerHTML+='<li> <a href='+count[i].url+'><div class="zbsimg"><img src='+count[i].img+'></div><dl><dt>'+count[i].title+'</dt><dd>'+count[i].abstract+'<p><span >直播中<img src="images/home_2.png"></span>'+count[i].nid+'</p></dd></dl></a> </li>'; 
	      		}
        	  }else{
        		  zb.innerHTML+='<li> <a href="#"><div class="zbsimg"><img src="images/zt.jpg"></div><dl><dt>当前无直播</dt><dd>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<p><span class="zant" >无直播<img src="images/home_3.png"></span>0</p></dd></dl></a> </li>'; 
        	  }
          }  
      });
});
 function switchTab(cursel,T_ymd){
	 if(cursel==1){
			var len = $("#zbs").html();
			var size = $.trim(len).length;
			if(size==0){
				$.ajax({
					type:'post',
					url:newsMain,
					data:{
						sid:'10001',
						pn:'1'
					},
			          success : function(json) {
			        	  var count = json.Resp.data;
			        	  var zb =document.getElementById('zbs');
			        	  if(count!=null){
				      		for(var i=0;i<count.length;i++){
				      			zb.innerHTML+='<li> <a href='+count[i].url+'><div class="zbsimg"><img src='+count[i].img+'></div><dl><dt>'+count[i].title+'</dt><dd>'+count[i].abstract+'<p><span >直播中<img src="images/home_2.png"></span>'+count[i].nid+'</p></dd></dl></a> </li>'; 
				      		}
			        	  }else{
			        		  zb.innerHTML+='<li> <a href="#"><div class="zbsimg"><img src="images/zt.jpg"></div><dl><dt>当前无直播</dt><dd>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<p><span class="zant" >无直播<img src="images/home_3.png"></span>0</p></dd></dl></a> </li>'; 
			        	  }
			          }  
			      });
		}
		}else if(cursel==2){
			var l = $("#con_one_2").html();
			var s = $.trim(l).length;
			if(s==0){
				$.ajax({
					type:'post',
					url:newsMain,
					data:{
						sid:'10002',
						pn:'1'
					},
			       success : function(json) {
				var count = json.Resp.data;
				if(count!=null){
					for(var i=0;i<count.length;i++){
						document.getElementById('con_one_2').innerHTML+=' <dl class="homenews"><dt>【'+count[i].type+'】</dt><dd><h2><a href='+count[i].url+'>'+count[i].title+'</a></h2><p>'+count[i].abstract+'</p><span>'+count[i].date+'<i><img src="images/home_5.png">'+count[i].nid+'</i></span></dd></dl>'; 
					}
				}else{
						document.getElementById('con_one_2').innerHTML+=' <dl class="homenews"><dt>【无最新资讯】</dt><dd><h2><a href="#">无最新资讯</a></h2></dd></dl>';
					}
				}
			});
		}}else if(cursel==3){
			
			var leng = $("#rili").html();
			var sizes = $.trim(leng).length;
			if(sizes==1086||sizes==1085){
				$.ajax({
					type:'post',
					url: newsMain,
					data:{
						sid:'10003',
						date:'2016-09-21'
					},
			      success : function(json) {
				var count = json.Resp.data;
				if(count!=null){
					for(var i=0;i<count.length;i++){
						document.getElementById('rili').innerHTML+=' <li><p class="rilitime"><A href='+count[i].url+'><img src="images/blan.png" ></A>'+count[i].date+'</p><p>'+count[i].title+'</p><p class="qys">'+count[i].abstract+'</p><p><img src="images/home_8.png" width="15" height="14"> <img src="images/home_8.png" width="15" height="14"> <img src="images/home_8.png" width="15" height="14"> <img src="images/home_9.png" width="15" height="14"> <img src="images/home_9.png" width="15" height="14"> </p></li>'; 
					}
				}else{
					document.getElementById('rili').innerHTML+='';
				}
				}
			});
		}else{
			if(T_ymd!=null||T_ymd!=""){
				$.ajax({
					type:'post',
					url: newsMain,
					data:{
						sid:'10003',
						date:T_ymd
					},
			      success : function(json) {
				var count = json.Resp.data;
				if(count!=null){
					for(var i=0;i<count.length;i++){
						document.getElementById('rili').innerHTML+=' <li><p class="rilitime"><A href='+count[i].url+'><img src="images/blan.png" ></A>'+count[i].date+'</p><p>'+count[i].title+'</p><p class="qys">'+count[i].abstract+'</p><p><img src="images/home_8.png" width="15" height="14"> <img src="images/home_8.png" width="15" height="14"> <img src="images/home_8.png" width="15" height="14"> <img src="images/home_9.png" width="15" height="14"> <img src="images/home_9.png" width="15" height="14"> </p></li>'; 
					}
				}else{
					document.getElementById('rili').innerHTML=' <p class="rilitime">'+T_ymd+'</p><p>当天无任何财经信息</p></li>';
				}
				}
			});
				
			}
			
		}
			
			
			
			
			var newDate = new Date();
			var date_year = newDate.getFullYear();
			var date_month = newDate.getMonth() + 1;
			var date_today = newDate.getDate();
			var date_day = newDate.getDay();
			//计算一个月内的天数,注意闰月
				var dayNum_in_month = [31,28,31,30,31,30,31,31,30,31,30,31];
				var isleapyear = date_year % 4;
				if(isleapyear == 0)
				{
					dayNum_in_month[1] = 29;
				}	
				var month_alldays = dayNum_in_month[date_month - 1]; //一共天数
				function GetDateYMD(AddDayCount,_ymd) {    
					   var dd = new Date();  
					   dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期  
					   var y = dd.getFullYear();   
					   var m = (dd.getMonth()+1)<10?"0"+(dd.getMonth()+1):(dd.getMonth()+1);//获取当前月份的日期，不足10补0  
					   var d = dd.getDate()<10?"0"+dd.getDate():dd.getDate();//获取当前几号，不足10补0  
					   if(_ymd=="y"){
						   return y;
					   }else if(_ymd =="m"){
						   return m;
					   }else if(_ymd =="d"){
						   return d;
					   }else if(_ymd =="ymd"){
						   return y+"-"+m+"-"+d; 
					   }
					}
				var set_Tday =[-10,-9,-8,-7,-6,-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9]; //获取当前日期前后十天
				
				//-----------------------------------------------------------------------------
				var count_TDay =[];
				// 获取需要的日期 ****-**-**
				for(var i=0;i<set_Tday.length;i++){
					count_TDay+= GetDateYMD(set_Tday[i],"ymd");
				}
				var count_Week =new Array();
				var week="";
				// 获取星期  0代表日
				for(var i=0;i<count_TDay.length;i++){
					if(!i%9==0||i==0){
						week+=count_TDay[i];
						if(week.length==10){
							count_Week +=new Date(week).getDay();
							week="";
						}
					}
				}
				var count_Day ="";
				// 获取 dd 20
				for(var i=0;i<set_Tday.length;i++){
					if(i<19){
					count_Day+= GetDateYMD(set_Tday[i],"d")+",";
					}
				}
				var set_Day = new Array();
				 set_Day = count_Day.split(",");
				 
				var count_Mm ="";
				// 获取 mm 20
				for(var i=0;i<set_Tday.length;i++){
					if(i<19){
					count_Mm+= GetDateYMD(set_Tday[i],"m")+",";
					}
				}
				var set_Mm = new Array();
				 set_Mm = count_Mm.split(",");
				var count_Yy ="";
				// 获取 YY 20
				for(var i=0;i<set_Tday.length;i++){
					if(i<19){
					count_Yy+= GetDateYMD(set_Tday[i],"y")+",";
					}
				}
				var set_Yy = new Array();
				 set_Yy = count_Yy.split(",");
				
				var show_week= ['日','一','二','三','四','五','六']; 
				var weekstr="";
				for(var i=0;i<count_Week.length;i++){
					if(i<19){
					weekstr+=show_week[count_Week[i]]+" ";
					}
				}
				var set_week = new Array();
				set_week =weekstr.split(" ");
				for(var k=0;k<set_Day.length;k++){
					if(set_Day[k]==date_today){
						set_week[k]="今";
					}
				}
				$("#month").text(date_month+"月");
				for(var j=0;j<set_Day.length;j++){
					if(j==10){
						document.getElementById('calendar').innerHTML+='<li class="rlhover"  onclick="set_clickTime(this)" ><p class="pday">'+set_Day[j]+'</p><span class="sday">'+set_week[j]+'</span><span class="hM">'+set_Mm[j]+'</span><span class="hM">'+set_Yy[j]+'</span></li>';
						
					}else{
						document.getElementById('calendar').innerHTML+='<li class="rlhover" onmouseover="setFocus(this)" onclick="set_clickTime(this)" onmouseout="setFocusOut(this)" ><p>'+set_Day[j]+'</p><span>'+set_week[j]+'</span><span class="hM">'+set_Mm[j]+'</span><span class="hM">'+set_Yy[j]+'</span></li>';
					}
				}	
		}
	 
 }
 
function set_clickTime(obj){
	 var _click =obj.childNodes;
	 var _cTime =_click[0].textContent;
	 var _cM = _click[2].textContent;
	 var _cY = _click[3].textContent;
	 var _ymd=_cY+"-"+_cM+"-"+_cTime;
	 switchTab(3,_ymd);
 };
	//当鼠标指针指到当前日期单元格
	function setFocus(obj)
	{
		var _node = obj.childNodes;
		_node[0].style.backgroundColor = "#e93030";
		_node[0].style.color="#fff";
		_node[1].style.color="#e93030";
	}
	//当鼠标指针离开当前日期单元格
	function setFocusOut(obj)
	{
		var _node = obj.childNodes;
		_node[0].style.backgroundColor = "#fff";
		_node[0].style.color="#e93030";
		_node[1].style.color="#999";
	}
 
</script>
</head>
<body>
<header>
  <div class="logo">彩贻现货</div>
</header>
<section class="slider wrap" >
  <ul>
    <li><img src="images/banner.jpg" width="100%"></li>
  </ul>
</section>
<div class="wrap">
  <div class="hdtitle"><a href="#">查看更多<img src="images/home.png"></a>热门交易品种</div>
  <ul class="hdhot clearfix">
    <li><strong>美元油连</strong>
      <p>46.42 <span>-0.38/-0.81% </span></p>
    </li>
    <li><strong>美元油连</strong>
      <p >46.42 <span>-0.38/-0.81% </span></p>
    </li>
    <li style=" border:none"><strong>美元油连</strong>
      <p class="hdred">47.42 <span>0.48/0.81% </span></p>
    </li>
  </ul>
  <div class="hdhome">
    <ul class="hometitle">
      <li id="one1" onClick="setTab('one', 1, 3);switchTab(1);" class="hover">金牌直播室</li>
      <li id="one2" onClick="setTab('one', 2, 3);switchTab(2);">黄金资讯</li>
      <li id="one3" onClick="setTab('one', 3, 3);switchTab(3);">财经日历</li>
    </ul>
    <div class="homecon">
      <div id="con_one_1">
        <ul class="zbslist" id="zbs">
        </ul>
      </div>
      <div id="con_one_2" style="display:none">
      </div>
      <div id="con_one_3" style="display:none">
        <div class="rili"><h1><span id="month"></span></h1>
        <div ><i class="riliright"  id="rightCalendar"><img src="images/my_arrow.png" ></i>
        <i id="leftCalendar" ><img src ="images/home_6.png"></i>
        <div class="rilicenter">
        <div class="rilixian"></div>
        <ul class="rililist" id="calendar">
        
        </ul>
        </div>
        </div>
        </div>

        <ul class="rilicon" id="rili" >
          <li>
            <p class="rilitime"><A href="#"><img src="images/blan2.png" ></A>2016-07-12 14:00:00</p>
            <p>德国6月CPI月率终值(%)</p>
            <p class="qys"><span>前值：</span>0.1
              <label><span>预期：</span>0.1 </label>
              <span>实际：</span>0.1</p>
            <p><img src="images/home_8.png" width="15" height="14"> <img src="images/home_8.png" width="15" height="14"> <img src="images/home_8.png" width="15" height="14"> <img src="images/home_9.png" width="15" height="14"> <img src="images/home_9.png" width="15" height="14"> </p>
            <div class="rilixia">
              <p><span>公布机构：</span>美国商业统计局</p>
              <p><span>下次公布：</span>08月09日22:00</p>
              <p><span>统计方法：</span></p>
              <p><span>数据影响：</span>实际值< 预期值=利好货币</p>
              <p><span>发布频率：</span>每月</p>
              <div class="yi"><span>数据释义：</span>
                <p>美元强势归来美元强势归来美元强势归来美元强势归来 金价无奈跌落1170</p>
                <span>关注原因：</span>
                <p>美元强势归来美元强势归来美元强势归来美元强势归来 金价无奈跌落1170</p>
              </div>
            </div>
          </li>
   
        
        </ul>
      </div>
    </div>
  </div>
</div>
<!--END-->
<div class="footer"></div>
<footer>
  <ul>
    <li class="hover" ><a href="index.html"><i class="navicon"></i>首 页</a></li>
    <li><a href="quotes/quotes.html"><i class="navicon2"></i>行 情</a></li>
    <li><a href="deal.html"><i class="navicon3"></i>交 易</a></li>
    <li><a href="consult.html"><i class="navicon4"></i>咨 询</a></li>
    <li><a href="my.html"><i class="navicon5"></i>我 的</a></li>
  </ul>
</footer>
</body>
</html>